var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, i) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var i in e)
              Object.prototype.hasOwnProperty.call(e, i) && (t[i] = e[i]);
          })(e, i);
      };
      return function (e, i) {
        function n() {
          this.constructor = e;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        t(e, i),
          (e.prototype =
            null === i
              ? Object.create(i)
              : ((n.prototype = i.prototype), new n()));
      };
    })(),
  AXShoppingDetailView = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        (e.onLoadShoppingDetailDataFn = {
          caller: e,
          code: 1266,
          method: function (t) {
            if (0 == t.code) {
              e.detail_Arr = t.list;
              for (var i, n = [], o = t.list, p = 0; p < o.length; p++)
                (i = {
                  lbl_shoppingDetaliName: { text: o[p].name },
                  lbl_shoppingNum: { text: o[p].num + " 个" },
                  lbl_shppingPrice: { text: o[p].price + " 银" },
                  shopping_ID: o[p].id,
                }),
                  n.push(i);
              e.list_shoppingDetail.array = n;
            }
          },
        }),
        WebSocketService.addListener(e.onLoadShoppingDetailDataFn),
        WebSocketService.addListener({
          caller: e,
          code: 1277,
          method: e.onLoadShoppingListDataFn,
        }),
        e.btn_shoppingDetailBack.on(
          Laya.Event.CLICK,
          e,
          e.onShoppingDetailDidClickFn
        ),
        (e.list_shoppingDetail.selectEnable = !0),
        e.list_shoppingDetail.on(Laya.Event.CLICK, e, e.onDetailItemDidClickFn),
        e
      );
    }
    return (
      __extends(e, t),
      (e.openShopView = function (t) {
        return (
          null == this.shoppingVC && (this.shoppingVC = new e()),
          (this.shoppingVC.curtype = t),
          "zahuo" == t
            ? WebSocketService.send({ c: 1266, d: { pageNum: 0 } })
            : WebSocketService.send({ c: 1277, d: { pageNum: 0 } }),
          this.shoppingVC
        );
      }),
      (e.prototype.onLoadShoppingListDataFn = function (t) {
        if (0 == t.code) {
          this.detail_Arr = t.list;
          for (var e, i = [], n = t.list, o = 0; o < n.length; o++)
            (e = {
              lbl_shoppingDetaliName: { text: n[o].name },
              lbl_shoppingNum: { text: n[o].num + " 个" },
              lbl_shppingPrice: { text: n[o].price + " 银" },
              shopping_ID: n[o].id,
            }),
              i.push(e);
          this.list_shoppingDetail.array = i;
        }
      }),
      (e.prototype.onDetailItemDidClickFn = function (t) {
        if ("" != t.target.name) {
          var e = this.detail_Arr[this.list_shoppingDetail.selectedIndex];
          "zahuo" == this.curtype
            ? AXGiveGiftView.showBackShop(e, "backbuy_zahuo")
            : AXGiveGiftView.showBackShop(e, "backbuy_kuangshi");
        }
      }),
      (e.prototype.onShoppingDetailDidClickFn = function () {
        this.removeSelf();
      }),
      e
    );
  })(ui.MarketController.AXShoppingDetailViewUI);
